package cn.tpshion.pulsar.listener;

import cn.tpshion.pulsar.listener.support.PulsarConsumerHandle;
import lombok.extern.slf4j.Slf4j;
import org.apache.pulsar.client.api.Consumer;
import org.apache.pulsar.client.api.Message;
import org.apache.pulsar.client.api.MessageListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class DefaultMessageListener<T> implements MessageListener<T> {

    @Autowired
    private PulsarConsumerHandle consumerHandle;

    @Override
    public void received(Consumer<T> consumer, Message<T> msg) {
        consumerHandle.handle(consumer, msg);
    }
}
